package List_;

import java.awt.*;
import java.util.*;
import java.util.List;

public class Company {
    private String cname;
    private String adress;
    private String scope;
    private String number;
    Map <String,Employee>map = new HashMap<>();


    public Company() {
    }

    public Company(String cname, String adress, String scope, String number) {
        this.cname = cname;
        this.adress = adress;
        this.scope = scope;
        this.number = number;
    }

    public String getCname() {
        return cname;
    }

    public void setCname(String cname) {
        this.cname = cname;
    }

    public String getAdress() {
        return adress;
    }

    public void setAdress(String adress) {
        this.adress = adress;
    }

    public String getScope() {
        return scope;
    }

    public void setScope(String scope) {
        this.scope = scope;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public void showCompany() {
        System.out.println("公司名称" + cname);
        System.out.println("公司地址" + adress);
        System.out.println("公司电话号码" + number);
        System.out.println("公司经营范围" + scope);
    }

    //输出员工信息
    public void showstaff() {
        System.out.println("显示员工信息");
        Set<Map.Entry<String,Employee>> entries = map.entrySet();
        Iterator<Map.Entry<String, Employee>> iterator = entries.iterator();
        while (iterator.hasNext()) {
            Map.Entry<String, Employee> next = iterator.next();
            System.out.println("工号=2"+next.getKey() + " " + next.getValue());
        }
    }

    //添加员工
    public boolean add(String id, Employee employee) {
        if (map.containsKey(id)) {
            System.out.println("员工已存在");
            return false;
        }
        map.put(id,employee);
        System.out.println("员工添加成功");
        return true;
    }

    //辞退员工
    public boolean fire(String id) {
        if (map.containsKey(id)) {
            map.remove(id);
            System.out.println("员工已开除");
            return true;
        }
        return false;
    }

    //显示公司人数
    public void shows() {
        System.out.println(map.size());
    }

    //获得公司薪水最高的员工的方法


    public void findTopSalary() {

   //System.out.println("薪水最高的人是：" + name1 + "工资为" + max);

    }
}
